/* 
 *  Copyright (c) 2011—2013 Panguso.com. All rights reserved. 
 *  File Name:  LogFilter.java                                      
 *  File Contents Outline :  日志过滤                  
 *  File  Create Date:   2012年7月30日
 *  File Version#: Revision#: #1                  
 *  File  Latest Modify Date : 2013年1月16日
 *  File Author :  bachuan@panguso.com
 */
/*

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.thu.log.filter.logfilter;

import cn.edu.thu.log.read.LogBuffer;
import java.util.ArrayList;

/**
 *
 * @author wan
 */
public class LogFilter {  
    private ReadContentByTagName readcontent;
    private ArrayList<String> classifyTagList;
    
    public LogFilter(){
        readcontent=new ReadContentByTagName();
        classifyTagList=new ArrayList<String> ();
    }
    public void setClassifyTags(String classifyTags){
     //   System.out.println("classifyTags:"+classifyTags);       
        String [] classifyArray=classifyTags.split(",");
        System.out.println("XES classiflyTags:"+classifyTags);
        for(int i=0;i<classifyArray.length;i++){ 
           classifyTagList.add(classifyArray[i]);  
        }     
        readcontent.setClassifyTagList(classifyTagList);  
    }
    
    public void filter(LogBuffer record){  
        for(String tagname:classifyTagList){
            readcontent.getAndCutContentByTagName(tagname, record);
//            System.out.println("filter get:"+record.getLogBodyMap().get("hit"));
        }    
    }   
}
